package demo;


import org.apache.flink.api.common.eventtime.WatermarkStrategy;
import org.apache.flink.configuration.Configuration;

import org.apache.flink.connector.file.src.FileSource;
import org.apache.flink.connector.file.src.reader.TextLineInputFormat;
import org.apache.flink.core.fs.Path;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

import java.awt.event.WindowAdapter;

/**
 *
 */
public class Flink08_File {
    public static void main(String[] args) throws Exception {

        /**
         * 创建执行环境
         * IDEA运行的时候，
         * 需要导入依赖
         */
        StreamExecutionEnvironment executionEnvironment = StreamExecutionEnvironment.createLocalEnvironmentWithWebUI(new Configuration());


        FileSource<String> build = FileSource.forRecordStreamFormat(new TextLineInputFormat(), new Path("data/word.txt")).build();

        DataStreamSource<String> stringDataStreamSource = executionEnvironment.fromSource(build, WatermarkStrategy.noWatermarks(), "Flink08_File");

        stringDataStreamSource.print();
        executionEnvironment.execute();


    }
}
